<template>
  <basic-dialog
    :visible="dialogVisible"
    :title="'请选择调价表单'"
    :width="'30%'"
    :handleClose="handleCloseDialog"
    :handleOk="handleSubmit"
    :okText="'提交'"
  >
    <el-radio-group class="radio-group" v-model="selectPriceType">
      <el-radio
        v-for="item in priceOption"
        :key="item.label"
        :label="item.label"
      >{{item.text}}</el-radio>
    </el-radio-group>
  </basic-dialog>
</template>
<script>
import BasicDialog from '@/components/BasicDialog';
// import { handleOpenNewPage } from '@/utils/bizUtils';

export default {
  name: 'AdjustPriceDialog', // 调价
  components: {
    BasicDialog,
  },
  props: {
    visible: {
      type: Boolean,
      default: false
    },
    recordNo: {
      type: String,
      default: ''
    }
  },
  data () {
    return {
      selectPriceType: '',
      priceOption: [
        { label: 1, text: '修改进价单计量', routerName: 'enterPriceEdit' },
        { label: 2, text: '修改进价多计量', routerName: 'enterPriceSteelEdit' },
        { label: 3, text: '批量修改进价', routerName: 'batchModifyPurchaseList' }
      ]
    };
  },
  computed: {
    dialogVisible () {
      return this.visible;
    },
  },
  methods: {
    handleSubmit () {
      if (!this.selectPriceType) {
        return this.$message.warning('请选择调价类型')
      }
      const routerName = this.priceOption.find(item => item.label == this.selectPriceType).routerName;
      this.$router.push({ name: routerName, query: { isPriceCycle: true } })
    },
    // 关闭弹框
    handleCloseDialog () {
      this.$emit('update:visible', false);
    },
  }
};
</script>
<style lang="less" scoped>
  .radio-group {
    label {
      margin-bottom: 5px;
    }
  }
</style>
